home *** CD-ROM | disk | FTP | other *** search
/ Software Vault: The Gold Collection / Software Vault - The Gold Collection (American Databankers) (1993).ISO / cdr49 / 273_01.zip / SWRITEC.CA < prev    next >
Text File  |  1993-04-04  |  973b  |  41 lines

  1. #include <dos.h>
  2. swrite_c(int row, int col, char ch)
  3. /* This will do a direct video write of the character ch. It will be
  4.    placed at location row,col using attribute attr.
  5. */
  6. {
  7.   extern int color, mono, cga, ega, scrseg, bios;
  8.   union REGS inregs, outregs;
  9.   int   scrofs, *pattr, orow, ocol ,x;
  10.   char pchar;
  11.   char far *base;
  12.   char far *work;
  13.     if(mono) base=(char far *)0xb0000000;
  14.     else base=(char far *)0xb8000000;
  15.     if(bios) {
  16.         locate(row,col) ;
  17.         inregs.h.bh=0x00;
  18.         inregs.h.ah=0x0a;
  19.         inregs.h.al=ch;
  20.         inregs.x.cx=0x01;
  21.         int86(0x10,&inregs,&inregs);
  22.         return(0);
  23.     }
  24.     scrofs = ((((row+1) * 160) - 160) + ((col+1) * 2)) - 2;
  25.     work = base + scrofs;
  26.     pchar = ch;
  27.     asm les bx,work
  28.     asm mov cl,pchar
  29.     if(cga) {
  30.             asm     mov    dx,03dah
  31.             asm        in    al,dx
  32.             asm        test al,1
  33.             asm        jnz $-3
  34.             asm        in    al,dx
  35.             asm        test al,1
  36.             asm        jz $-3
  37.         }
  38.     asm mov byte ptr es:[bx],cl
  39.     return(0);
  40. }
  41.